class_name SoundView
extends BaseView

#region 属性
@onready var bgmh_slider: HSlider = %BGMHSlider
@onready var sfxh_slider: HSlider = %SFXHSlider
#endregion
#region 字段
#endregion
#region 信号
#endregion

#region 基类方法
func init_view():
	super.init_view()
func on_enter(args:Dictionary = {}):
	super.on_enter()
func on_pause(args:Dictionary = {}):
	super.on_pause()
func on_resume(args:Dictionary = {}):
	super.on_resume()
func on_exit(args:Dictionary = {}):
	super.on_exit()
func get_view_state() -> GameEnum.ViewState:
	return super.get_view_state()
#endregion
#region 公共方法
func update_vol():
	bgmh_slider.value = GameStorageSystem.get_save_data().sound.BGM
	sfxh_slider.value = GameStorageSystem.get_save_data().sound.SFX
#endregion
#region 私有方法
func _set_BGM_vol(value_changed:bool):
	if not value_changed:
		return
	GameStorageSystem.get_save_data().sound.BGM = bgmh_slider.value
func _set_SFX_vol(value_changed:bool):
	if not value_changed:
		return
	GameStorageSystem.get_save_data().sound.SFX = sfxh_slider.value
#endregion
#region 生命周期函数
func _ready() -> void:
	bgmh_slider.drag_ended.connect(_set_BGM_vol)
	sfxh_slider.drag_ended.connect(_set_SFX_vol)
#endregion
